﻿using System;
using System.Web.Security;
using BitsOfJoy.Core.web;

namespace BitsOfJoy.login
{
    public partial class login : BOJPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void Login_Click(Object sender, EventArgs e)
        {
            string hashedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(password.Text, "MD5");
            if (Global.LoginMapper.Trylogin(username.Text, hashedPassword))
            {
                FormsAuthentication.RedirectFromLoginPage(username.Text, true);
            }
            else
            {
                status.InnerHtml += "Invalid Login";
            }

        }
    }
}
